package day11;

import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.Scanner;

public class Demo4 {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        test3();
    }
    public static void test1(){
        System.out.println("请输入你的生日(yyyy-MM-dd):");
        String brthday = sc.next();
        LocalDate time1 = LocalDate.parse(brthday);
        LocalDate time2 = LocalDate.now();
        System.out.println(time1);
        System.out.println(time2);
        int year = time1.until(time2).getYears();
        System.out.println("几岁:"+year);
    }

    public static void test2(){
        LocalDate ld = LocalDate.now();
        ld=ld.withDayOfMonth(1);
        ld=ld.plusMonths(2);
        ld=ld.minusDays(3);
        System.out.println(ld);
    }

    public static void test3(){
        System.out.println("生产日期(yyyy-MM-dd):");
        String productionTime = sc.next();
        System.out.println("保质期(天):");
        int shelfLife = sc.nextInt();
        LocalDate ld = LocalDate.parse(productionTime);
        ld = ld.plusDays(shelfLife);
        //ld = ld.with(DayOfWeek.MONDAY);
        ld = ld.minusWeeks(2);
        ld = ld.with(DayOfWeek.WEDNESDAY);
        System.out.println(ld);
    }
}
